#include "usagetracker.h"

using namespace std;

vector<UsageInfo> UsageTracker::Entries = vector<UsageInfo>();

void UsageTracker::AddEntry(int DestPort, string IP, int Size){
	bool found = false;
	int i;
	for (i = 0; i < Entries.size(); i++){
		if (Entries[i].Port == DestPort && Entries[i].IP == IP){
			found = true;
			break;
		}
	}
	
	if (found){
		Entries[i].TotalSize += Size;
	} else {
		Entries.push_back(UsageInfo(DestPort, IP, Size));
	}
}

void UsageTracker::Clear(){
	Entries.clear();
}